package com.wxh.bomb.netty.thread.executor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程池
 *
 * @author wxh
 * @date：2017.10.13
 */
public class TheadPool {

    public static void main(String[] args) {
        /**
         * 以下常用线程池都是ThreadPoolExecutor
         */

        // 创建固定数量的线程池
        ExecutorService pool1 = Executors.newFixedThreadPool(10);

        // 创建单个的线程池
        ExecutorService pool2 = Executors.newSingleThreadExecutor();

        // 具有缓冲的线程池，线程数量没有上线
        ExecutorService pool3 = Executors.newCachedThreadPool();

        // 创建固定数量的线程池
        ExecutorService pool4 = Executors.newScheduledThreadPool(10);


    }
}
